
#ifndef  IDATA_H
#define  IDATA_H

#include <memory>

class KvPair {
public:
    static KvPair * make(const int key, const char * value){
       return new KvPair(key, value);
    }

    KvPair(const int key, const char * value)
    :key(key), value(value)
    {
    }
    ~KvPair() {}

    int getKey()const { return key;}
    void setKey(const int key) { this->key = key; } 
    const char * getValue() const { return value;}
    void setValue(const char * value) { this->value = value; }

private:
    int key;
    const char * value;
};


class IKvContainer {
public:
    virtual ~IKvContainer(){
    }

    class Iterator{
    public:
        virtual ~Iterator(){}
        virtual bool hasNext() const = 0;
        virtual KvPair next() = 0;
    };

    virtual int init() = 0;
    virtual int deinit() = 0;

    virtual std::shared_ptr<IKvContainer::Iterator> iterator() = 0;

    virtual const char * get(const int key) const = 0;
    virtual int put(const int key, const char * value) = 0;
    virtual int remove(const int key) = 0;

    virtual int size() = 0;

};





#endif   /* IDATA_H */
